package com.qf.controller.market;

import com.qf.service.DtsOrderGoodsService;
import com.qf.service.DtsOrderService;
import com.qf.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author bss
 * @version V1.0
 * @Project maven
 * @Package com.qf.controller.market
 * @Description:
 * @Date 2022/10/19 21:07
 */
@RestController
@RequestMapping("/admin/order")
public class AdminOrderController {
    @Autowired
    DtsOrderService orderService;
    @Autowired
    DtsOrderGoodsService orderGoodsService;

///:8083/admin/order/list?page=1&limit=20&orderStatusArray=201&sort=add_time&order=desc&userId=123&orderSn=123

    @GetMapping("/list")
    public Object list(@RequestParam(value = "page",required = false,defaultValue = "1") Integer page ,
                       @RequestParam(value = "limit",required = false,defaultValue = "20") Integer limit,
                       @RequestParam(value = "sort",required = false,defaultValue = "add_time") String sort,
                       @RequestParam(value = "order",required = false,defaultValue = "desc") String order,
                       Integer userId,Integer orderSn,Integer orderStatusArray){

        Map<String,Object> data = orderService.selectOrderByPage(page,limit,sort,order,userId,orderSn,orderStatusArray);
        return ResponseUtil.ok(data);
    }

    @GetMapping("/listShipChannel")
    public Object listShipChannel(){

        List<Map<String,Object>> data = orderService.selectShipChannel();
        return ResponseUtil.ok(data);
    }

    @GetMapping("/detail")
    public Object detail(Integer id){



        Map<String,Object> data = orderGoodsService.selectdetail(id);

        return ResponseUtil.ok(data);
    }
}
